package cn.hy.shortUrl.entity;

import lombok.*;


@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@ToString
public class R<T> {
	private Integer code;
	private String msg;

	private T data;

	public R(Integer code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public static <T> R<T> ok(String msg, T data) {
		return new R(200, msg, data);
	}

	public static <T> R <T> create(Integer code, String msg, T data) {
		return new R(code, msg, data);
	}

	public static R create(Integer code, String msg) {
		return new R(code, msg);
	}
}
